import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
    import news from '@/views/modules/news/list'
    import yuangong from '@/views/modules/yuangong/list'
    import tuizhuxinxi from '@/views/modules/tuizhuxinxi/list'
    import lianluoren from '@/views/modules/lianluoren/list'
    import fangjianxinxi from '@/views/modules/fangjianxinxi/list'
    import storeup from '@/views/modules/storeup/list'
    import jiankangxinxi from '@/views/modules/jiankangxinxi/list'
    import gongyuxinxi from '@/views/modules/gongyuxinxi/list'
    import zhusuxinxi from '@/views/modules/zhusuxinxi/list'
    import jiaofeixinxi from '@/views/modules/jiaofeixinxi/list'
    import qingjiaxinxi from '@/views/modules/qingjiaxinxi/list'
    import laoren from '@/views/modules/laoren/list'
    import messages from '@/views/modules/messages/list'
    import fangkejilu from '@/views/modules/fangkejilu/list'


//2.配置路由   注意：名字
const routes = [{
    path: '/index',
    name: '首页',
    component: Index,
    children: [{
      // 这里不设置值，是把main作为默认页面
      path: '/',
      name: '首页',
      component: Home,
      meta: {icon:'', title:'center'}
    }, {
      path: '/updatePassword',
      name: '修改密码',
      component: UpdatePassword,
      meta: {icon:'', title:'updatePassword'}
    }, {
      path: '/pay',
      name: '支付',
      component: pay,
      meta: {icon:'', title:'pay'}
    }, {
      path: '/center',
      name: '个人信息',
      component: center,
      meta: {icon:'', title:'center'}
    }
      ,{
	path: '/news',
        name: '公告信息',
        component: news
      }
      ,{
	path: '/yuangong',
        name: '员工',
        component: yuangong
      }
      ,{
	path: '/tuizhuxinxi',
        name: '退住信息',
        component: tuizhuxinxi
      }
      ,{
	path: '/lianluoren',
        name: '联络人',
        component: lianluoren
      }
      ,{
	path: '/fangjianxinxi',
        name: '房间信息',
        component: fangjianxinxi
      }
      ,{
	path: '/storeup',
        name: '我的收藏管理',
        component: storeup
      }
      ,{
	path: '/jiankangxinxi',
        name: '健康信息',
        component: jiankangxinxi
      }
      ,{
	path: '/gongyuxinxi',
        name: '公寓信息',
        component: gongyuxinxi
      }
      ,{
	path: '/zhusuxinxi',
        name: '住宿信息',
        component: zhusuxinxi
      }
      ,{
	path: '/jiaofeixinxi',
        name: '缴费信息',
        component: jiaofeixinxi
      }
      ,{
	path: '/qingjiaxinxi',
        name: '请假信息',
        component: qingjiaxinxi
      }
      ,{
	path: '/laoren',
        name: '老人',
        component: laoren
      }
      ,{
	path: '/messages',
        name: '留言板管理',
        component: messages
      }
      ,{
	path: '/fangkejilu',
        name: '访客记录',
        component: fangkejilu
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {icon:'', title:'login'}
  },
  {
    path: '/register',
    name: 'register',
    component: register,
    meta: {icon:'', title:'register'}
  },
  {
    path: '/',
    name: '首页',
    redirect: '/index'
  }, /*默认跳转路由*/
  {
    path: '*',
    component: NotFound
  }
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  mode: 'hash',
  /*hash模式改为history*/
  routes // （缩写）相当于 routes: routes
})

export default router;
